
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <link href="<?php echo base_url();?>application/css/common.css" type="text/css" rel="stylesheet">
        <link href="<?php echo base_url();?>application/js/jquery-ui-1.8.16/css/redmond/jquery-ui-1.8.16.custom.css" type="text/css" rel="stylesheet" />
                <link href="<?php echo base_url();?>application/css/jquery.jgrowl.css" type="text/css" rel="stylesheet" />

	<script src="<?php echo base_url();?>application/js/jquery-ui-1.8.16/js/jquery-1.6.2.min.js" type="text/javascript"></script>
        <script src="<?php echo base_url();?>application/js/jquery-ui-1.8.16/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
        <script src="<?php echo base_url();?>application/js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
        <script src="<?php echo base_url();?>application/js/jquery.jgrowl_compressed.js" type="text/javascript"></script>

	<script type="text/javascript">
                $(function(){
			 <?php
                        foreach($adminNotes as $note){?>
                            $.jGrowl("<?php echo $note->noteBody;?>",{header:"<?php echo $note->noteHeader;?>",sticky:true})
                         <?php }?>
                   $("#admin-tabs").tabs();
                   $("#datepicker").datetimepicker();
                   $("#deleteEvents").click(function(){
                       var postValue="";
                        $(".deletecheck:checked").each(function(i,el){

                                var eid=$(el).attr("id");
                                if(i+1==$(".deletecheck:checked").length){
                                    postValue+=eid;
                                    return false;
                                }
                                postValue+=eid+";";
                        });
                        $.ajax({
                            url:"<?php echo base_url();?>/backdoor/deleteEvent",
                            data:{"eids":postValue},
                            type:"post",
                            success:function(d,s){
                                if(s=="success"){
                                    if(d=='1'){
                                        var ids=postValue.split(";");
                                        $.each(ids,function(k,val){
                                            $("#"+val).remove();

                                            $("#event-"+val.substr(val.indexOf("-")+1)).remove();
                                        });
                                    }
                                }
                            }
                        });
                   });//end of click
                   $("#filterTool").change(function(){
                       
                        var selected=$("#filterTool option:selected").val();
                        if(selected!=0){
                            $.ajax({
                                url:"<?php echo base_url();?>/backdoor/filterUser",
                                data:{"eid":selected},
                                type:"POST",
                                success:function(d,s){
                                    if(s=="success"){
                                        if(d!='0'){
                                            $(".people-container").html(d);// replace the whole container content
                                        }
                                    }
                                }
                            });
                        }
               });
                });//end of document ready func
         </script>
        <style type="text/css">
            .eventWrapper{padding:10px 20px 0px 20px;}
            .imageHolder{float:left;display:inline-block;position: relative;top:40px;left:4px;}
            .eventData{display: inline-block;}
            .eventData ul{margin-bottom: 2px;padding-left:8px;}
            .eventData ul li.tag{width:110px;font-weight: normal;}
            .evtname{font-weight:bold;font-size:18px;}
            .evtnav{font-size:12px;}
            .eventbox{border-bottom:1px solid grey;width:480px;margin-left: 30px;margin-top:5px;padding-bottom:8px;}
            .eventbox:hover{background-color:#01DFD7;cursor: pointer;}
            .deletecheck{position:absolute;margin-top:65px;}
            .buttonsGroup{margin-top:15px;margin-left:28px;}
            .people{border:1px dotted #000000;width:500px;margin-bottom:5px;}
            .people ul{margin:5px 0px 5px 0px;}
            /*time and date picker*/
            .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
            .ui-timepicker-div dl { text-align: left; }
            .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
            .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
            .ui-timepicker-div td { font-size: 90%; }
            .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
        </style>
    </head>
    <body>
            <div class="logo"></div>
            <div id="admin-tabs">
                <ul>
                    <li><a href="#event-tab">Events Records</a></li>
                     <li><a href="#people-tab">People Records</a></li>
                      <li><a href="#forum-tab">Forums Records</a></li>
                </ul>
                <div id="event-tab">
                    <div>
                       
                        <form action="/backdoor/addEvent" method="POST">
                            <ul>
                                <li><label>Event name:</label></li>
                                <li><input type="text" value="" name="eName"/></li>
                            </ul>
                             <ul>
                                <li><label>Event Desc:</label></li>
                                <li><textarea cols="30" rows="5" name="eDesc"></textarea></li>
                            </ul>
                             <ul>
                                <li><label>Event time:</label></li>
                                <li><input type="text" value="" name="tStamp" id="datepicker"/></li>
                            </ul>
                            <div>
                            <ul style="padding:0px;">
                                <li>
                                    <ul>
                                        <li><label>Event city:</label></li>
                                        <li><input type="text" value="" name="city"/></li>
                                    </ul>
                                </li>
                                <li>
                                    <ul>
                                        <li><label>Event sate:</label></li>
                                        <li><input type="text" value="" name="state" maxlength="2" /></li>
                                    </ul>
                                </li>
                                <li>
                                    <ul>
                                        <li><label>Event Zip Code:</label></li>
                                        <li><input type="text" value="" name="zipcode"/></li>
                                    </ul>
                                </li>

                            </ul>
                            </div>
                            <ul>
                                <li><input type="submit" value="Submit"/></li>
                            </ul>
                        </form>
                    </div>
                    <hr/>
                    <div style="width:400px;text-align:center;"><span style="font-size:28px;font-weight: bold;color:#85B5D9;">Events</span></div>
                <div class="events-containers">
                 <?php foreach($events as $key => $evt){
                    $location = $evt->city.', '.$evt->state;
                    $date = date("F l \\t\h\e jS Y",  strtotime($evt->tStamp));

                ?>
                    <input type="checkbox" id="cb-<?php echo $evt->eid; ?>" class="deletecheck"/>
                <div class="eventbox bindEventBoxes" id="event-<?php echo $evt->eid?>">
                    
                    <div class="imageHolder">
                        <img alt="image" src="<?php echo base_url()?>application/images/placeholder.jpg" />
                    </div>
                    <div class="eventData">
                        <ul class="large">
                            <li class="tag">Event Name:</li>
                            <li id="eventboxName"><?php echo $evt->eName; ?></li>
                        </ul>

                        <ul class="medium">
                            <li class="tag">Event Date:</li>
                            <li><?php echo $date; ?></li>
                        </ul>

                        <ul class="medium">
                            <li class="tag">Event Location:</li>
                            <li><?php echo $location; ?></li>
                        </ul>
                    </div>
                </div><!-- end of eventbox-->
            <?php } ?>
                        </div>
                    <div class="buttonsGroup">
                        <button id="deleteEvents">Delete</button>

                    </div>
                </div>

                <div id="people-tab">
                    <div class="filters">
                        <ul>
                            <li>Filter by event:</li>
                            <li>
                            <select id="filterTool">
                                <option value="0" selected="yes">Select One</option>
                                <?php foreach($events as $e){ ?>
                                    <option value="<?php echo $e->eid;?>"><?php echo $e->eName;?></option>
                                <?php }?>
                            </select>
                            </li>
                        </ul>
                    </div>
                    <hr/>
                    <div class="people-container">
                     
                        <?php foreach($users as $user){?>
                            <div class="people" id="people-<?php echo $user->userId?>">
                                <ul>
                                    <li>Name:</li>
                                    <li><?php echo $user->fName ." ".$user->lName; ?></li>
                                </ul>
                                <ul>
                                    <li>Location:</li>
                                    <li><?php echo $user->userCity .", ".$user->userState." ".$user->userZip; ?></li>
                                </ul>
                                <ul>
                                    <li>Email:</li>
                                    <li><?php echo $user->email; ?></li>
                                </ul>
                                <ul>
                                    <li>User Interests:</li>
                                    <li><?php echo $user->userInterest; ?></li>
                                </ul>
                                <ul>
                                    <li>User Bio:</li>
                                    <li><?php echo $user->userBio; ?></li>
                                </ul>
                            </div>
                        <?php }?>
                    </div>

                </div>
                <div id="forum-tab">
                    <div class="forum-container">
                         What!!?? it is not done yet. we don't even have a forum now. Suck it up hahaha
                    </div>
                </div>
            </div>
    </body>
</html>
